<?xml version="1.0" encoding="UTF-8"?>
<!--

       Copyright 2006-2018 the original author or authors.

       Licensed under the Apache License, Version 2.0 (the "License");
       you may not use this file except in compliance with the License.
       You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing, software
       distributed under the License is distributed on an "AS IS" BASIS,
       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       See the License for the specific language governing permissions and
       limitations under the License.

-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>The &lt;columnOverride&gt; Element</title>
  <link rel="stylesheet" type="text/css" href="../mbgstyle.css" />
</head>
<body>
<h1>The &lt;columnOverride&gt; Element</h1>
<p>MyBatis Generator (MBG) uses the &lt;columnOverride&gt; element to change certain
attributes of an introspected database column from the values that would be calculated by
default.  This element is an optional child
element of the <a href="table.html">&lt;table&gt;</a> element.</p>

<h2>Required Attributes</h2>
<table border="1" cellspacing="0" cellpadding="5">
  <tr>
    <th>Attribute</th>
    <th>Description</th>
  </tr>
  <tr>
    <td>column</td>
    <td>The column name of the introspected.</td>
  </tr>
</table>

<h2>Optional Attributes</h2>
<table border="1" cellspacing="0" cellpadding="5">
  <tr>
    <th>Attribute</th>
    <th>Description</th>
  </tr>
  <tr>
    <td valign="top">property</td>
    <td>The name of a Java property to be used.  If not specified,
        MBG will generate properties based on the column name.
        For example, if a table has a column named "STRT_DTE" then MBG
        will generate the property name as either "STRT_DTE" or "strtDte"
        based on the value of the "useActualColumnNames" property (see the
        description of the <a href="table.html">&lt;table&gt;</a> element for more information).
        This property could be used to rename the column "startDate"</td>
  </tr>
  <tr>
    <td valign="top">javaType</td>
    <td>The fully qualified Java Type of the property for this column.  This
        can be used to override the type calculated by the <code>JavaTypeResolver</code>
        if required.  For some databases, this is necessary to handle
        "odd" database types (e.g. MySql's unsigned bigint type
        should be mapped to java.lang.Object).</td>
  </tr>
  <tr>
    <td valign="top">jdbcType</td>
    <td>The JDBC Type (INTEGER, DECIMAL, NUMERIC, VARCHAR, etc.) for the column.
        This can be used to override the type calculated by the <code>JavaTypeResolver</code>
        if required.  For some databases this is necessary to handle JDBC driver
        quirks (e.g. DB2's LONGVARCHAR type should be mapped to VARCHAR for MyBatis).</td>
  </tr>
  <tr>
    <td valign="top">typeHandler</td>
    <td>A user defined type handler that should be used for this column.
      This should be the fully
      qualified name of a class that implements MyBatis'
      <code>TypeHandler</code> 
      interface.
      If unspecified, or blank,
      then MyBatis will use the default type facility for handling types.
      <b>Important:</b> MBG does not verify that this type handler exists,
      or is valid.  MBG simply inserts this value at the appropriate places
      in the generated SQL Map configuration file.
    </td>
  </tr>
  <tr>
    <td valign="top">delimitedColumnName</td>
    <td>Specifies whether the column name should be delimited in the generated SQL.
        MBG will automatically delimit the column name if the name contains a space,
        so this override is only necessary when the column name must be forced to a certain
        case, or when the column name is a reserved word in the database.
        <p>When "true", the <code>column</code> attribute for the override
        must exactly match the case of the column name returned from the database.</p>
        <p>The delimiter characters are specified on the
        <a href="context.html">&lt;context&gt;</a> element.</p>
        <p><i>The default value is false.  However, MBG will automatically
        delimit column names that contain a space, so no override is necessary
        in that case.</i></p>
    </td>
  </tr>
  <tr>
    <td valign="top">isGeneratedAlways</td>
    <td>Specifies whether the column is a GENERATED ALWAYS column in the database.  If the column
        is GENERATED ALWAYS then MBG will not reference the column in insert or update
        statements.
        <p><i>The default value is false.</i></p>
        <p>Since version 1.3.4</p>
    </td>
  </tr>
</table>

<h2>Child Elements</h2>
<ul>
  <li><a href="property.html">&lt;property&gt;</a> (0..N)
    Note: any properties specified here will be added to the
    properties collection of the corresponding IntrospectedColumn.  MBG does not currently
    respond to any properties.  This element is provided so that special values
    for each column may be provided to a plugin in the event that a plugin is
    coded to generate or modify something unique to a particular column.</li>
</ul>

<h2>Supported Properties</h2>
<p>This table lists the properties of the default SQL Map generators that can be
specified with the <a href="property.html">&lt;property&gt;</a> child element:</p>
<table border="1" cellspacing="0" cellpadding="5">
  <tr>
    <th>Property Name</th>
    <th>Property Values</th>
  </tr>
  <tr>
    <td valign="top">trimStrings</td>
    <td>
      This property is used to select whether MyBatis Generator adds code to trim
      the white space from character fields returned from the database.
      This can be useful if your database stores data in CHAR fields rather than
      VARCHAR fields.  When true for a character field/column, MyBatis Generator will 
      insert code to trim leading and trailing whitespace.
      This property value overrides the property if specified at the 
      <a href="table.html">&lt;javaModelGenerator&gt;</a> and/or 
      <a href="javaModelGenerator.html">&lt;table&gt;</a> level.
      
      <p><i>The default value is inherited from the 
      <a href="table.html">&lt;javaModelGenerator&gt;</a> and/or 
      <a href="javaModelGenerator.html">&lt;javaModelGenerator&gt;</a>, otherwise false.</i></p></td>
  </tr>
</table>
</body>
</html>
